%%% TikZ help file
%%% Macro: dimensioning of angles
%
%
%	EXAMPLE:
%	\angleDimensioning[fill=orange!40]{0,0}{0}{30}{1}{orange!80!black}{0}{$\alpha$}{orange}
%
%
%	\angleDimensioning[OPT]{P0}{ANG0}{ANG1}{R}{DRAWOPT}{FLAG}{LBL}{LBLOPT} draws a
%	circular sector from angle ANG0 to ANG1 of radius R using the fill-color OPT
%	(or its default value). The draw-options DRAWOPT are applied to the circular
%	arc. The center point is located at P0. The label LBL is placed depending on
%	the value of the FLAG (0 or 1) using the options LBLOPTS.
%
%
%	INPUTS:
%	#1	OPT ....... optional: fill-color
%	#2	P0 ........ center point
%	#3	ANG0 ...... start angle
%	#4	ANG1 ...... end angle
%	#5	R ......... radius
%	#6	DRAWOPT ... style of arrow (arrow head, collor, thick/thin)
%	#7	SWITCH .... flag to place the label inside the filled area (0) or at the circle (1)
%	#8	LBL ....... label text
%	#9	LBLOPT .... label options
%
%
%	DEPENDENCIES:
%	requires the layers 'background' and 'foreground' to be defined:
%	\pgfdeclarelayer{background}
%	\pgfdeclarelayer{foreground}
%	\pgfsetlayers{background,main,foreground}
%

% Subject: TikZ graphics
% $Author: georgnoname@gmail.com $
% $LastChangedDate: 2015-04-22 06:48:38 +0000 (Wed, 22 Apr 2015) $
% $Revision: 29 $


\newcommand{\angleDimensioning}[9][fill=orange!40]{%
	
	%\pgfmathsetmacro{\centerPoint}{#2}
	\pgfmathsetmacro{\angStart}{#3}
	\pgfmathsetmacro{\angStop}{#4}
	%\pgfmathsetlengthmacro{\radius}{#5}
	
	% fill
	\begin{pgfonlayer}{background}
		\path[#1]
		(#2) -- +(\angStart:#5) arc(\angStart:\angStop:#5) -- cycle;
	\end{pgfonlayer}
	
	% dimensioning
	\begin{pgfonlayer}{foreground}
		\draw[->,#6] % draw=#6 % see page 493 of tikz manual
		(#2) +(\angStart:#5) arc(\angStart:\angStop:#5);
	\end{pgfonlayer}
	
	% nodes
	\def\note{#7}
	\if\note0
		%\coodinate (lbl) at ((#2) -- +(\angStart/2 + \angStop/2:#5*2/3));
		\path (#2) -- +(\angStart/2 + \angStop/2:#5*2/3) node(lbl){};
	\else
		\if\note1
			%\coodinate (lbl) at (#2) -- +(\angStart/2 + \angStop/2:#5*2/3);
			\path (#2) -- +(\angStart/2 + \angStop/2:#5) node(lbl){};
		\fi
	\fi
	
	\path (lbl) node[
					sloped,
					%inner sep=0cm,
					%above,
					%anchor = center,
					%minimum height=1cm
					%minimum width=1cm
				][#9]{#8};
	
}
